export interface APIResult<T = any> {
    code: number
    msg: string
    data: T
}

export interface APIPaging<T> {
    total: number
    items: T[]
}

export interface PaginationParams {
    pageIndex: number
    pageSize: number
}

export interface InboundConfirmationDTO {
    id: string
    subject: string
    materialCode: string
    confirmTime: string
    manager?: string
    relatedProject?: string
}

export interface OutboundConfirmationDTO {
    id: string
    orderNumber: string
    materialCode: string
    materialName: string
    specification: string
    unit: string
    quantity: number
    warehouse: string
    shippingTime: string
    status: 'pending' | 'confirmed' | 'shipped'
    receiver?: string
    contactPhone?: string
    address?: string
}

export interface OutboundCreateParams {
    materialCode: string
    quantity: number
    warehouse: string
    expectedShipTime: string
}
// 在文件末尾追加以下内容
export interface InventoryItemDTO {
    id: string
    materialCode: string
    materialName: string
    specification: string
    unit: string
    currentStock: number
    availableStock: number
    allocatedStock: number
    warehouse: string
    location?: string
    lastUpdated: string
}

export interface InventoryMovementDTO {
    id: string
    documentNumber: string
    movementType: 'inbound' | 'outbound' | 'transfer' | 'adjustment'
    materialCode: string
    quantity: number
    fromWarehouse?: string
    toWarehouse?: string
    createdAt: string
}

export interface InventoryQueryParams {
    materialCode?: string
    warehouse?: string
    includeZeroStock?: boolean
}
// 在文件末尾追加以下内容
export interface MaterialDTO {
    id: string
    code: string
    name: string
    spec: string
    type: string
    unit: string
    safetyStock: number
    currentStock: number
    purchaseLeadTime: number // 采购提前期（天）
    supplier?: string
    images?: string[]
    isActive: boolean
}

export interface MaterialQueryParams {
    codeOrName?: string
    type?: string
    includeInactive?: boolean
}

export interface MaterialCreateParams {
    code: string
    name: string
    spec: string
    type: string
    unit: string
    safetyStock?: number
}
// 在文件末尾追加以下内容
export interface SupplierDTO {
    id: string
    code: string
    name: string
    contactPerson: string
    contactPhone: string
    email?: string
    address: string
    taxNumber: string
    paymentTerm: number // 账期（天）
    bankAccount?: string
    bankName?: string
    status: 'active' | 'inactive' | 'blacklisted'
    materialsSupplied?: string[] // 可供应物料编码数组
}

export interface SupplierQueryParams {
    codeOrName?: string
    status?: string
    materialCode?: string // 按供应物料筛选
}

export interface SupplierCreateParams {
    code: string
    name: string
    contactPerson: string
    contactPhone: string
    address: string
    taxNumber: string
    paymentTerm: number
}

// 在文件末尾追加以下内容
export interface PurchaseOrderDTO {
    id: string
    orderNumber: string
    supplierId: string
    supplierName: string
    status: 'draft' | 'submitted' | 'approved' | 'rejected' | 'completed'
    totalAmount: number
    paymentTerm: number
    expectedDeliveryDate: string
    createdAt: string
    createdBy: string
    items: PurchaseItemDTO[]
}

export interface PurchaseItemDTO {
    id: string
    materialCode: string
    materialName: string
    specification: string
    unit: string
    quantity: number
    unitPrice: number
    totalPrice: number
    receivedQuantity: number
}

export interface PurchaseCreateParams {
    supplierId: string
    expectedDeliveryDate: string
    items: Array<{
        materialCode: string
        quantity: number
        unitPrice: number
    }>
}

export interface PurchaseQueryParams {
    orderNumber?: string
    supplierId?: string
    status?: string
    dateRange?: [string, string]
}